package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.StatisticsDto;
import com.heima.wemedia.service.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: StatisticsController
 * Description:
 * date: 2023/9/1 0001 15:26
 *
 * @author zHan
 */
@RestController
@RequestMapping("/api/v1/statistics")
@Api(tags = "自媒体图文数据统计相关接口")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;

    /**
     * 统计数量
     *
     * @param beginDate
     * @param endDate
     * @return
     */
    @GetMapping("/newsDimension")
    @ApiOperation("统计数量")
    public ResponseResult newsDimension(@DateTimeFormat(pattern="yyyy-MM-dd") String beginDate,
                                        @DateTimeFormat(pattern="yyyy-MM-dd")String endDate) {
        return statisticsService.newsDimension(beginDate, endDate);
    }

    /**
     * 查询统计内容
     *
     * @param dto
     * @return
     */
    @GetMapping("/newsPage")
    @ApiOperation("查询文章内容")
    public ResponseResult newsPage(StatisticsDto dto) {
        return statisticsService.newsPage(dto);
    }
}
